using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Mud.Client.WPF
{
    /// <summary>
    /// Interaction logic for WindowChooseCharacter.xaml
    /// </summary>

    public partial class WindowChooseCharacter : System.Windows.Window
    {


        public Creature Selected
        {
            get { return _selected; }
        }
        private Creature _selected;

        public WindowChooseCharacter(IList<Creature> characters)
        {
            InitializeComponent();
            lvCharacters.ItemsSource = characters;
        }

        private void btnOk_Click(object sender, EventArgs args)
        {
            if (this.lvCharacters.SelectedItem == null)
            {
                MessageBox.Show("Please select character.");
                return;
            }
            _selected = (Creature)this.lvCharacters.SelectedItem;
            this.DialogResult = true;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs args)
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}